Test-Series - programming logic

Test Number 12/15

Q: Local Variable is having _______ scope ?
A.  only inside current Program
B. global
C. inter program
D. local
Solution: The correct answer is:
local
Q: Inner Block can access variables declared ___________.
A. inside Inner Block
B. inside Same Block
C. inside Outer Block
D. None of these
Solution: The correct answer is: 
inside Outer Block
Q: What is the output of the following code statements? The compiler saves the first integer at the memory location 4165 and the rest at consecutive memory spaces in order of declaration. An integer is one byte long.

interger a
pointer c,d
a=30
c=&a
d=c
a=a+10
print *c
A. 4166
B. 30
C. 4165
D. 40
Solution: The correct answer is:
40
Q: Local Variable is Accessible in - [Select Appropriate Option(s)]
A. From block in which it is declared
B. From function
C. From Main
D. None of these
Solution: The correct answers are:
From function,

From block in which it is declared
Q: Higher priority is given to ________ variable than _______ variable.
A. Local , Global
B. Global , Local
C. data , string
D. string , data
Solution: The correct answer is:
Local , Global
Q: What is the output of this code?

int main() {

 int a = 0, i = 0, b; 

 for (i = 0;i < 5; i++)

 { 

 a++; continue;

}

}
A. 5
B. 2
C. 1
D. 4
Solution: The correct answer is:
5
Q: What will be the output of the following program?

//assume all header files are included


void main()
{
int var1=10;
{
int var2=20;
printf("%d %d",var1,var2);
}
printf("%d %d",var1,var2);
}
A. Run Time Error
B. 10 20 10 garbage
C. 10 20 10 20
D. Compile Time Error
Solution: The correct answer is:
Compile Time Error
Q: What is the output of the following code statements? The compiler saves the first integer at the memory location 4062. An integer is one byte long.

interger a
pointer b
a=20
b=&a
print *b
A. 10
B. 4063
C. 4062
D. 20
Solution: The correct answer is:
20
Q: Guess the output of program -

//assume all header files are included

void main()
{
int var1=10;
{
int var1=20;
printf("%d %d",var1,var1);
}
printf("%d %d,var1,var1");
}
A. 20 20 10 10
B. 10 10 20 20
C. 20 10 20 10
D. 10 20 10 20
Solution: The correct answer is: 20 20 10 10

You Have Score    /9